<?php
namespace Plugin\Organization\Schema;

use Plugin\Organization\Model\RdOrganizeUserApply;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 用户权限申请
 */
#[Schema(title: 'RdOrganizeUserApplySchema')]
class RdOrganizeUserApplySchema implements \JsonSerializable
{
    #[Property(property: 'id', title: '主键', type: 'bigint')]
    public string $id;

    #[Property(property: 'user_id', title: '申请人', type: 'bigint')]
    public string $user_id;

    #[Property(property: 'area', title: '申请范围1:项目,2:工区,3:站', type: 'tinyint')]
    public string $area;

    #[Property(property: 'area_ids', title: '申请范围id', type: 'json')]
    public string $area_ids;

    #[Property(property: 'role', title: '角色1:管理员,2:安全员', type: 'tinyint')]
    public string $role;

    #[Property(property: 'apply_id', title: '审批人id', type: 'bigint')]
    public string $apply_id;

    #[Property(property: 'status', title: '状态1:待审批,2:通过,3:拒绝', type: 'tinyint')]
    public string $status;

    #[Property(property: 'name', title: '申请名称', type: 'varchar')]
    public string $name;

    #[Property(property: 'apply_data', title: '审批结果数据', type: 'json')]
    public string $apply_data;

    #[Property(property: 'created_at', title: 'created_at', type: 'timestamp')]
    public string $created_at;

    #[Property(property: 'updated_at', title: 'updated_at', type: 'timestamp')]
    public string $updated_at;

    #[Property(property: 'remark', title: '备注', type: 'varchar')]
    public string $remark;





    public function __construct(RdOrganizeUserApply $model)
    {
       $this->id = $model->id;
       $this->user_id = $model->user_id;
       $this->area = $model->area;
       $this->area_ids = $model->area_ids;
       $this->role = $model->role;
       $this->apply_id = $model->apply_id;
       $this->status = $model->status;
       $this->name = $model->name;
       $this->apply_data = $model->apply_data;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;
       $this->remark = $model->remark;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'user_id' => $this->user_id ,'area' => $this->area ,'area_ids' => $this->area_ids ,'role' => $this->role ,'apply_id' => $this->apply_id ,'status' => $this->status ,'name' => $this->name ,'apply_data' => $this->apply_data ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at ,'remark' => $this->remark];
    }
}